#!/bin/sh -e

date=$(date -u +%Y-%m-%dT%H:%M:%SZ)
CGO_ENABLED=0 go build -v -mod=vendor -ldflags="-X 'main.version=$2' -X 'main.commit=null' -X 'main.builtBy=cpt' -X 'main.date=$date'"
clinst -Dm755 chezmoi "$1/usr/bin/chezmoi"
